package com.ruoyi.service.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.service.api.RemoteServiceService;
import com.ruoyi.service.api.RemoteServiceSortService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteServiceSortFallbackFactory implements FallbackFactory<RemoteServiceSortService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteServiceSortFallbackFactory.class);
    @Override
    public RemoteServiceSortService create(Throwable cause) {

        log.error("服务分类项目调用失败:{}", cause.getMessage());
        return new RemoteServiceSortService() {

            @Override
            public AjaxResult getInfo(Long id, String source) {
                return AjaxResult.error("通过id获取服务分类项目信息失败:" + cause.getMessage());
            }


        };
    }
}
